#ifndef SCREENINGCALCULOS_H
#define SCREENINGCALCULOS_H
#include "Screening.h"

class ScreeningCalculos : public Screening
{			// Algoritmo Screening
    private:
            void checkSprings(SPHERE *s);
            ELEMENT_LIST<LINE>* Lines;
            ForcaResultante* campo;
            REAL BoxMinH;
            REAL BoxMinV;
            REAL BoxMaxH;
            REAL BoxMaxV;
            bool MaterialOceanico;
            REAL DensidadeMatOc;
            REAL gravidade[2];
            bool valorDaVez;
            MODEL *modelo;
            bool rigido;
	public:
        ScreeningCalculos (MED *med, MODEL* pModel)
        {
            modelo=pModel;
            Cell = NULL;
            assert ((&pModel->SPHList)!=NULL);
            Spheres = &pModel->SPHList;
            Lines = &pModel->LINList;
            iniciaMatriz( med->max_rad, pModel->BoxMin, pModel->BoxMax );
            Forca = med->contato;
            campo = med->campoForca;
            BoxMinH=pModel->BoxMin[0];
            BoxMinV=pModel->BoxMin[1];
            BoxMaxH=pModel->BoxMax[0];
            BoxMaxV=pModel->BoxMax[1];
            MaterialOceanico = (pModel->SeaMat != NULL);
            if (pModel->SeaMat != NULL) DensidadeMatOc=pModel->SeaMat->Density;
            gravidade[0]=pModel->Gravity[0];
            gravidade[1]=pModel->Gravity[1];
            valorDaVez=0;
            for(SPRING* k = modelo->SPRList.Begin; k != NULL;k = k->Next) k->foiAcessado=0;
            rigido=(modelo->Boundary == MODEL::RIGID_BDR);

        }
        ~ScreeningCalculos(){
            if (Cell != NULL) {
                for (long i = 0; i < Rows+2; i++) delete [] Cell[i];
                delete [] Cell;
            }
		}
        void calcular();
};
#endif // SCREENINGCALCULOS_H
